package com.lee9213.mybatis.utility;

import org.mybatis.generator.api.dom.java.Interface;
import org.mybatis.generator.api.dom.java.TopLevelClass;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * class注释
 *
 * @author lee9213@163.com
 * @version 1.0
 * @date 2017/3/30 10:49
 */
public final class ClassDocUtil {

    private static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static void addClassJavaDoc(TopLevelClass topLevelClass, String author, String remarks){
        topLevelClass.addJavaDocLine("/**");
        topLevelClass.addJavaDocLine(" * " + remarks);
        topLevelClass.addJavaDocLine(" *");
        topLevelClass.addJavaDocLine(" * @author " + author);
        topLevelClass.addJavaDocLine(" * @version 1.0");
        topLevelClass.addJavaDocLine(" * @date " + format.format(new Date()));
        topLevelClass.addJavaDocLine(" */");
    }

    public static void addInterfaceJavaDoc(Interface interfaze, String author, String remarks){
        interfaze.addJavaDocLine("/**");
        interfaze.addJavaDocLine(" * " + remarks);
        interfaze.addJavaDocLine(" *");
        interfaze.addJavaDocLine(" * @author " + author);
        interfaze.addJavaDocLine(" * @version 1.0");
        interfaze.addJavaDocLine(" * @date " + format.format(new Date()));
        interfaze.addJavaDocLine(" */");
    }
}
